import React, { Component, PureComponent } from 'react'

export default class Son extends PureComponent {
  state = {
    msg: 'hello',
    obj: {
      name: 'zs',
    },
  }

  render() {
    console.log('Son更新了')
    return (
      <>
        <div>Son, {this.props.c}</div>
        <div>Son, {this.state.msg}</div>
        <div>Son, {this.state.obj.name}</div>
        <button
          onClick={() => {
            const newObj = { ...this.state.obj }
            newObj.name = 'ls'
            this.setState({
              //   msg: '性能优化',
              obj: newObj,
            })
          }}
        >
          SON的按钮
        </button>
      </>
    )
  }
}
